<template>
    <div :style="style.one">
        <span :style="style.left" v-text="Lang.from[lang][5]"></span>
        <div :style="style.right">
            <hb-select class="ilbk" :title="selected" :list="orderList" @select="e_select" :circle="true" lorr="left" />
            <span class="canuse" v-text="Lang.from[lang][6]">可用</span>
            <span class="red" v-text="balance"></span>
            <span v-text="selected"></span>
        </div>
    </div>
</template>

<script>
import {vpost, vlink} from '@api'
import style from './style.jsx'
import Lang from './lang.js'
export default {
	name: 'formitems',
	data() {
		return {
			Lang,
			style,
			orderList: [],
			selected: 'USDT',
			balance: '',
		}
	},
	created() {
		this.init()
	},
	computed: {
		lang() {
			return this.$store.state.setting.lang
		},
	},
	methods: {
		e_select(i, v) {
			this.selected = this.orderList[i].txt
			this.balance = this.orderList[i].balance
			this.$emit('select', 'coin', v)
			vpost(vlink.ddd.getCointypes).then(re => {
				if (re != null && re.status == 1) {
					this.orderList = re.data.fvirtualcointype
					this.selected = this.orderList[i].txt
					this.balance = this.orderList[i].balance
				}
			})
		},

		init() {
			vpost(vlink.ddd.getCointypes).then(re => {
				if (re != null && re.status == 1) {
					this.orderList = re.data.fvirtualcointype
					this.selected = this.orderList[0].txt
					this.balance = this.orderList[0].balance
					this.$emit('select', 'coin', this.orderList[0].value)
				}
			})
		},
	},
	mounted() {},
}
</script>

<style scoped>
.canuse {
	padding: 0 0 0 40px;
}
.red {
	padding: 0 10px;
	color: #9c0000;
}
</style>